﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using ProjectBase.Core;



using $prjsn$.Common.Validation;

namespace $safeprojectname$
{
    public abstract class RuleBase : IValidationRule
    {
        #region members

        private ValidateOn _validateOn = ValidateOn.Add | ValidateOn.Update;
        private int _order = 100;
        ApplyOn _applyOn = ApplyOn.Server | ApplyOn.Client;

        #endregion members

        #region Client Rules

        public virtual string GetClientRule(string prefix = null)
        {
            return string.Empty;
        }

        public virtual string GetClientMessage(string prefix = null)
        {
            return string.Empty;
        }

        public virtual IMDValidationRule GetMetaDataRule()
        {
            return null;
        }

        #endregion Client Rules

        #region override
        public override string ToString()
        {
            return GetType().Name + " | " + PropertyName;
        }
        #endregion override

        #region properties

        public ValidateOn ValidateOn
        {
            get { return _validateOn; }
            set { _validateOn = value; }
        }
        public ApplyOn ApplyOn
        {
            get { return _applyOn; }
            set { _applyOn = value; }
        }

        public virtual string GroupName { get; set; }

        public virtual int Order
        {
            get { return _order; }
            set { _order = value; }
        }

        public virtual bool BreakOnError { get; set; }
        public string PropertyName { get; protected set; }
        #endregion properties
    }
}